using IQIGame.Onigao.Framework;
using IQIGame.Onigao.Game;

namespace IQIGame.Onigao.GamePlay
{
    public class UD_HeroSkillLvPreview : UIBaseData
    {
        public HeroData heroData { get; set; }
        public int skillCid { get; set; }

        private HeroSkill _heroSkill;

        public HeroSkill heroSkill => _heroSkill;

        public UD_HeroSkillLvPreview Sync(HeroData heroData, int skilCid)
        {
            this.heroData = heroData;
            this.skillCid = skilCid;
            heroData.skills.TryGetValue(this.skillCid, out _heroSkill);
            return this;
        }

        public void Clear()
        {
            this.heroData = null;
            this.skillCid = 0;
            this._heroSkill = null;
        }

        #region 对象池

        public override void OnReset()
        {
            this.Clear();
        }

        static public UD_HeroSkillLvPreview NewFromPool()
        {
            return ClassPool<UD_HeroSkillLvPreview>.Get();
        }
        #endregion
    }
}
